#include "Scenery.h"

CScenery::CScenery(void)
{
}

CScenery::~CScenery(void)
{
}

CScenery::CScenery(double x, double y, char location[], bool background, int width, int height, bool move)
{
	this->x = x;
	this->y = y;
	this->move = move;
	hImage = LoadImage(NULL, location, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
	this->background = background;
	this->height = height;
	this->width = width;
}

void CScenery::Update(double x)
{
	if(move == true)
	{
		if(x > 400)
		{
			this-> x = (x / 4) - 100;
		}
		else
		{
			this-> x = 0;
		}
	}
}

void CScenery::Draw(HDC graphics)
{
	if(((this->x + 100) * 4) < (width + 400 + this->x) && move == true)
	{
		RenderHelper::RenderBitmap(graphics, hImage, x,y, width, height);
	}
	if(((this->x + 100) * 4) > (width - 400) && move == true)
	{
		RenderHelper::RenderBitmap(graphics, hImage, x + width,y, width, height);
	}
	if(move == false){
		RenderHelper::RenderBitmap(graphics, hImage, x, y, width, height);
	}
}